package cn.bx.bid.service;

import cn.bx.bid.dao.DepartmentDao;
import cn.bx.bid.entity.Department;
import cn.bx.bid.entity.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

//M V C
@Service


public class DepartmentService {
	public static final int PAGE_SIZE = Page.PAGE_SIZE;
	@Autowired
	private DepartmentDao departmentDao;


	public int add(Department d) {
			return departmentDao.add(d);
		}


	public int update(Department d) {
			return departmentDao.update(d);
	}


	public int batchDel(long[] ids) {
			return departmentDao.batchDel(ids);
	}

	public Page<Department> paging(int pageNo, int limit,String departmentName) {
			List<Department> list = departmentDao.search(pageNo, limit, departmentName);
			int total = departmentDao.searchTotal(departmentName);
			Page<Department> p = new Page<Department>(total, limit, list);
			return p;
	}

	public Department get(long id) {
		return departmentDao.get(id);
	}

	public int del(long id){return departmentDao.del(id);}
}
